package net.dengzixu.java.homework.period5;

import java.util.Random;

/**
 * 取随机数的个位、十位、百位
 *
 * @author Deng Zixu <admin@dengzixu.com>
 */
public class Period5Homework {
    public static void main(String[] args) {
        int randomNumber = new Random().nextInt(900) + 100;

        System.out.println("所取随机数为：" + randomNumber);

        System.out.println("他的百位为：" + randomNumber / 100);
        System.out.println("它的十位为：" + ((randomNumber % 100) / 10));
        System.out.println("它的个位为:" + randomNumber % 10);
    }
}
